from threading import Lock,RLock
import time
mutex = Lock() # 生成锁对象
mutex.acquire() # 加锁
mutex.release() # 解锁
mutex = RLock() # 生成可重入锁对象
mutex.acquire() # 加锁
mutex.release() # 解锁